package com.gexin.model.activity;

import com.gexin.common.utils.UUIDUtils;
import com.gexin.model.activity.base.BaseVistorOrder;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 业务名称:  t_vistor_order() 
 */
@SuppressWarnings("serial")
public class VistorOrder extends BaseVistorOrder<VistorOrder> {
	public static final VistorOrder dao = new VistorOrder();


	public void setCommonConditionalOrderIdAndIntegralAndIncomeOrAndTypeAndDesc(String orderId,BigDecimal integral,
																	  int incomeOr,int type, String desc){
		this.setId(UUIDUtils.getUUIDInOrderId()+"");
		this.setOrderId(orderId);
		this.setIntegral(integral);
		this.setIncomeOr(incomeOr);
		this.setType(type);
		this.setDesc(desc);
		long time = new Date().getTime();
		this.setCreateTime(time);
		this.setUpdateTime(time);
	}

	public VistorOrder getVistorOrder(String orderId){
		VistorOrder first = VistorOrder.dao.findFirst("select * from t_vistor_order where order_id=" + orderId);
		return first;
	}

	public List<VistorOrder> getVistorOrderList(){
		List<VistorOrder> vistorOrderList = VistorOrder.dao.find("select * from t_vistor_order "+
		 " order by create_time desc");
		return vistorOrderList;
	}
}
